草庐IT

php oci_bind_by_name float

全部标签

c++ - 没有模板重新绑定(bind)的 typedef 模板。作为模板类参数的模板使用

我想做这样的事情:templateclassBaseSubscriber{};templateclassBasePublisher{//notworking:invaliduseoftemplate-name'BaseSubscriber'withoutanargumentlisttypedefBaseSubscriberSubscriberType;//compilingtypedefBaseSubscriberSubscriberTypeT;};templateclassSubscriber,classData>classClassA:publicSubscriber{};temp

c++ - 如何将绑定(bind)与通过引用传递的抽象类结合使用

我正在尝试使用std::transform和std::bind来简化循环。这是一些代码:classITest{public:virtualCPruebaPrueba(doublep,doubled=0)const=0;};voidfoo(constITest&test){std::vectorv;std::vectorvRes;//...//...std::transform(v.begin(),v.end(),back_inserter(vRes),bind(&ITest::Prueba,test,_1,0));//...}这不会编译。我正在使用VS2008SP1,我遇到了很多我不理

c++ - 使用 boost::lambda::bind 有什么问题?

我正在尝试使用boost::lambda::bind()定义一个谓词,我将其传递给Boost.Range中的find_if算法。具体来说,我想搜索结构vector以找到特定成员具有指定值的第一个条目。我的例子如下:#include#include#includeusingnamespacestd;usingnamespaceboost;usingnamespaceboost::lambda;structfoo{strings;intx;};intmain(){//createlistandaddacoupleentriesvectorfooList;foof1={"abc",1};fo

c++ - 警告 : resolving Func by linking to Func@##

我正在构建一个包含以下内容的DLL:extern"C"__declspec(dllexport)void__stdcallDrawMouse(intX,intY,intR,intG,intB){Buffer.SetMouse(X,Y,R,G,B);}然后在.def文件中我添加了:LIBRARYTest;DESCRIPTION"TestDefinitionFile"EXPORTSDrawMouse;然后当我编译时,我添加链接器选项:-static-static-libstdc++-static-libgcc-Wl,--kill-at-d--input-defsrc\Test.def-m3

c++ - 从零开始的 Lua/C++ 绑定(bind)

我是Lua的新手,正在尝试了解一些基础知识。我想了解的是将Lua绑定(bind)到C++实例。我对第三方库不感兴趣,我想在更基础的层面上理解这一点-谢谢:)这是我的问题:根据我所阅读的内容,我的假设是Lua只能绑定(bind)到静态C函数。这是正确的吗?这是否意味着要绑定(bind)C++类的实例,我首先需要为我想要的每个方法和属性getter/setter编写静态函数,并接受实例指针作为参数。我会在Lua中注册这些函数。我会向Lua传递一个指向C++类实例的指针。我会从Lua调用其中一个注册函数,传递C++实例指针。静态函数取消引用指针,调用等效方法。这有意义吗?还是我弄错了什么?感

c++ - 如何将可变参数模板参数绑定(bind)到函数

我正在尝试模仿std::thread构造函数的功能:templateexplicitthread(Function&&f,Args&&...args);我试过使用调试器单步执行以查看它是如何工作的,但我无法弄明白。如何像线程的构造函数那样创建和存储绑定(bind)类型?像这样(语法可能有误):classmyClass{private:autobindType;public:templateexplicitmyClass(Function&&f,Args&&...args):bindType(somehowBind(f,args){}voidevaluate(){bindType();}

c++ - 警告 : array 'alphabet' initialized by parenthesized string literal

在模板函数中,我目前有以下行:staticconstunsignedcharalphabet[17]=(Uppercase)?("0123456789ABCDEF"):("0123456789abcdef");其中Uppercase是模板参数。使用-pedanticgcc告诉我:warning:array'alphabet'initializedbyparenthesizedstringliteral'("0123456789abcdef")'如何摆脱该消息(我希望alphabet位于堆栈中)? 最佳答案 使代码明确有效的最简单方法

c++ - 警告 : non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]

这个问题在这里已经有了答案:C++ArrayInitializersWarnings(2个答案)关闭8年前。我刚刚在我的机器上安装了最新版本的cygwin和eclipseluna。它工作正常,我能够运行我的项目。但是,当我构建它们时,我收到了我不明白的警告。例如,这是我从“c++Primer”一书的网站上获得的头文件“Sales_item.h”的警告:warning:defaultedanddeletedfunctionsonlyavailablewith-std=c++11or-std=gnu++11[enabledbydefault]Sales_item()=default;^..

c++ - 在通过在 main 中声明数组来解决之前,数组绑定(bind)不是整数常量

程序1#includestd::size_tthree(){return3;}inti[three()];intmain(){return0;}方案二std::size_tthree(){return3;}intmain(){inti[three()];return0;}这里的问题是程序1如预期的那样给出了编译错误"error:arrayboundisnotanintegerconstantbefore']'token"但是不知道为什么程序2编译成功了? 最佳答案 C99允许inti[three()];声明一个变长数组,但只允许if

c++ - 在模板模板参数中抛出多模板类 - 模板绑定(bind)?

给定以下类:templateclassB>classA{Bb;};我现在可以写这样的代码了:Aa1;Aa2;将除一个参数外所有参数都指定的多参数类放入B中的最优雅方法是什么?像带有int-keys的map?我唯一能想到的是:templateusingC=MyMap;A>a3;是否有这样一个模板等同于std::bind,我们可以只提供一部分参数并保留其中一个参数?我很确定该语言没有提供此功能,但人们之前一定已经解决了这个问题。A>a3; 最佳答案 没有与std::bind等效的内置模板,但您可以自己编写一个。这是一个简单的版本,它绑定